#pragma once
#include "zMatrix.hpp"
//just a special derivation of zmatrix(1,n) or zmatrix(n,1), column major is default

namespace zzz{
template<typename T, typename Major=zColMajor>
class zVector : public zMatrix<T,Major>
{
public:
  //constructor
  explicit zVector(){}
  explicit zVector(zuint l):zMatrix<T,Major>(Major::Dim_==0?1:l, Major::Dim_==0?l:1){}
  zVector(const zVector<T,Major> &other)
  {
    *this=other;
  }
  explicit zVector(const zMatrixBaseR<T,Major> &other)
  {
    *this=other;
  }
  
  //operator()
  using zMatrix<T,Major>::operator();
  const T operator()(zuint l) const
  {
    return zMatrix<T,Major>::operator()(Major::Dim_==0?0:l,Major::Dim_==0?l:0);
  }
  T& operator()(zuint l)
  {
    return zMatrix<T,Major>::operator()(Major::Dim_==0?0:l,Major::Dim_==0?l:0);
  }
  zSubMatrixW<T,Major> operator()(const zVConstantContinuousVector<int,Major> &r)
  {
    if (Major::Dim_==0)
      return zMatrix<T,Major>::operator()(Colon(0,0),r);
    else
      return zMatrix<T,Major>::operator()(r,Colon(0,0));
  }
  zSubMatrixW<T,Major> operator()(const zMatrixBaseR<int,Major> &r)
  {
    if (Major::Dim_==0)
      return zMatrix<T,Major>::operator()(Colon(0,0),r);
    else
      return zMatrix<T,Major>::operator()(r,Colon(0,0));
  }

  //operator=
  const zMatrixBaseW<T,Major>& operator=(const zVector<T,Major>& other)
  {
    return zMatrix<T,Major>::operator =((const zMatrix<T,Major>&)other);
  }
  const zMatrixBaseW<T,Major>& operator=(const zMatrixBaseR<T,Major>& other)
  {
    return zMatrix<T,Major>::operator =(other);
  }
};

}
